ValidationMarker.inherit("Control");

ValidationMarker.eventManager = new EventManager();

var listener = new Object();
listener.onload = function () {
    var DotNetValidatorUpdateIsValid = ValidatorUpdateIsValid;
    ValidatorUpdateIsValid = function () {
        var result = DotNetValidatorUpdateIsValid();
        ValidationMarker.eventManager.fireEvent("updateisvalid", {"validators":Page_Validators});
        return result;
    }    
}

EventHandler.windowEventHandler.registerListener("load", listener);



function ValidationMarker(node){
    this.Control(node);
    this.validators = this.properties.getObject("validators");
    this.setValid(this.properties.getObject("isValid"));
    ValidationMarker.eventManager.registerListener(this);
    
}


ValidationMarker.prototype.onupdateisvalid = function (eventArgs) {
    this.setValid(true);
    if (!Utils.isDefined(this.validators)) return;
    for (var i = 0; i<this.validators.length; i++){
        if (this.validators[i].isvalid) continue;
        this.setValid(false);
        return;
    }           
}

ValidationMarker.prototype.setValid = function (value) {
    this.node.style.display = value?"none":"block";     
}
